< Prev(J) / Next(K) > / View :

Filename: /text/sbasic/shared/03080301.xhp

(section: randomize) (bookmark: bm_id3150616)
Randomize statement

Randomize ステートメント

Randomize Statement [Runtime]
Randomize ステートメント [実行時](hd_id3150616.1)

Initializes the random-number generator.
乱数発生関数を初期化します。(par_id3145090.2)

(/section: randomize)

Syntax:
構文:(hd_id3147573.3)

Randomize [Number]
Randomize [Number](par_id3145315.4)

Parameters:
パラメータ:(hd_id3152456.5)

Number: Any integer value that initializes the random-number generator. If Number is omitted, the generator uses the current value of the system timer.
Number: 乱数発生関数を初期化するための整数値。この値を省略すると、システム時計の値を使って乱数発生関数を初期化します。(par_id3149670.6)

(embed text/sbasic/shared/00000003.xhp#errorcode : linkinfo)

Error Codes

エラーコード(hd_id3152869.37)

(/embed text/sbasic/shared/00000003.xhp#errorcode)

(embed text/sbasic/shared/00000003.xhp#err5 : linkinfo)

5 Invalid procedure call
5 無効なプロシージャー呼び出しです (par_id3150891.41)

(/embed text/sbasic/shared/00000003.xhp#err5)

Example:
例:(hd_id3149655.7)

Sub ExampleRandomize
Sub ExampleRandomize(par_id3151211.8)

Dim iVar As Integer, sText As String
Dim iVar As Integer, sText As String(par_id3147229.9)

Dim iSpectral(10) As Integer
Dim iSpectral(10) As Integer(par_id3150870.10)

Randomize 2^14-1
Randomize 2^14-1(par_id3148673.12)

For iCount = 1 To 1000
For iCount = 1 To 1000(par_id3156423.13)

iVar = Int((10 * Rnd) ) REM Range from 0 to 9
iVar = Int((10 * Rnd) ) REM 0 から 9 の値を生成(par_id3147288.14)

iSpectral(iVar) = iSpectral(iVar) +1
iSpectral(iVar) = iSpectral(iVar) +1(par_id3155132.15)

Next iCount
Next iCount(par_id3153143.16)

sText = " | "
sText = " | "(par_id3154011.18)

For iCount = 0 To 9
For iCount = 0 To 9(par_id3151114.19)

sText = sText & iSpectral(iCount) & " | "
sText = sText & iSpectral(iCount) & " | "(par_id3145748.20)

Next iCount
Next iCount(par_id3146921.21)

MsgBox sText,0,"Spectral Distribution"
MsgBox sText,0,"Spectral Distribution"(par_id3148617.22)

end sub
end sub(par_id3152941.23)


< Prev / Next >